#pragma once
#include "mstypes.i"
#include "IUnknown_swig.h"
enum DWRITE_PARAGRAPH_ALIGNMENT
{
    DWRITE_PARAGRAPH_ALIGNMENT_NEAR,
    DWRITE_PARAGRAPH_ALIGNMENT_FAR,
    DWRITE_PARAGRAPH_ALIGNMENT_CENTER
};

enum DWRITE_TEXT_ALIGNMENT
{
    DWRITE_TEXT_ALIGNMENT_LEADING,
    DWRITE_TEXT_ALIGNMENT_TRAILING,
    DWRITE_TEXT_ALIGNMENT_CENTER
};
enum DWRITE_FONT_WEIGHT
{
    DWRITE_FONT_WEIGHT_THIN = 100,
    DWRITE_FONT_WEIGHT_EXTRA_LIGHT = 200,
    DWRITE_FONT_WEIGHT_ULTRA_LIGHT = 200,
    DWRITE_FONT_WEIGHT_LIGHT = 300,
    DWRITE_FONT_WEIGHT_NORMAL = 400,
    DWRITE_FONT_WEIGHT_REGULAR = 400,
    DWRITE_FONT_WEIGHT_MEDIUM = 500,
    DWRITE_FONT_WEIGHT_DEMI_BOLD = 600,
    DWRITE_FONT_WEIGHT_SEMI_BOLD = 600,
    DWRITE_FONT_WEIGHT_BOLD = 700,
    DWRITE_FONT_WEIGHT_EXTRA_BOLD = 800,
    DWRITE_FONT_WEIGHT_ULTRA_BOLD = 800,
    DWRITE_FONT_WEIGHT_BLACK = 900,
    DWRITE_FONT_WEIGHT_HEAVY = 900,
    DWRITE_FONT_WEIGHT_EXTRA_BLACK = 950,
    DWRITE_FONT_WEIGHT_ULTRA_BLACK = 950
};

enum DWRITE_WORD_WRAPPING
{
    DWRITE_WORD_WRAPPING_WRAP,
    DWRITE_WORD_WRAPPING_NO_WRAP
};

enum DWRITE_READING_DIRECTION
{
    DWRITE_READING_DIRECTION_LEFT_TO_RIGHT,
    DWRITE_READING_DIRECTION_RIGHT_TO_LEFT
};
enum DWRITE_FLOW_DIRECTION
{
    DWRITE_FLOW_DIRECTION_TOP_TO_BOTTOM
};
enum DWRITE_TRIMMING_GRANULARITY
{
    DWRITE_TRIMMING_GRANULARITY_NONE,
    DWRITE_TRIMMING_GRANULARITY_CHARACTER,
    DWRITE_TRIMMING_GRANULARITY_WORD	
};
enum DWRITE_LINE_SPACING_METHOD
{
    DWRITE_LINE_SPACING_METHOD_DEFAULT,
    DWRITE_LINE_SPACING_METHOD_UNIFORM
};
enum DWRITE_FONT_STRETCH
{
	DWRITE_FONT_STRETCH_UNDEFINED = 0,
	DWRITE_FONT_STRETCH_ULTRA_CONDENSED = 1,
	DWRITE_FONT_STRETCH_EXTRA_CONDENSED = 2,
	DWRITE_FONT_STRETCH_CONDENSED = 3,
	DWRITE_FONT_STRETCH_SEMI_CONDENSED = 4,
	DWRITE_FONT_STRETCH_NORMAL = 5,
	DWRITE_FONT_STRETCH_MEDIUM = 5,
	DWRITE_FONT_STRETCH_SEMI_EXPANDED = 6,
	DWRITE_FONT_STRETCH_EXPANDED = 7,
	DWRITE_FONT_STRETCH_EXTRA_EXPANDED = 8,
	DWRITE_FONT_STRETCH_ULTRA_EXPANDED = 9
};

enum DWRITE_FONT_STYLE
{
	DWRITE_FONT_STYLE_NORMAL,
	DWRITE_FONT_STYLE_OBLIQUE,
	DWRITE_FONT_STYLE_ITALIC
};
enum DWRITE_INFORMATIONAL_STRING_ID
{
	DWRITE_INFORMATIONAL_STRING_NONE,
	DWRITE_INFORMATIONAL_STRING_COPYRIGHT_NOTICE,
	DWRITE_INFORMATIONAL_STRING_VERSION_STRINGS,
	DWRITE_INFORMATIONAL_STRING_TRADEMARK,
	DWRITE_INFORMATIONAL_STRING_MANUFACTURER,
	DWRITE_INFORMATIONAL_STRING_DESIGNER,
	DWRITE_INFORMATIONAL_STRING_DESIGNER_URL,
	DWRITE_INFORMATIONAL_STRING_DESCRIPTION,
	DWRITE_INFORMATIONAL_STRING_FONT_VENDOR_URL,
	DWRITE_INFORMATIONAL_STRING_LICENSE_DESCRIPTION,
	DWRITE_INFORMATIONAL_STRING_LICENSE_INFO_URL,
	DWRITE_INFORMATIONAL_STRING_WIN32_FAMILY_NAMES,
	DWRITE_INFORMATIONAL_STRING_WIN32_SUBFAMILY_NAMES,
	DWRITE_INFORMATIONAL_STRING_PREFERRED_FAMILY_NAMES,
	DWRITE_INFORMATIONAL_STRING_PREFERRED_SUBFAMILY_NAMES,
	DWRITE_INFORMATIONAL_STRING_SAMPLE_TEXT
};
enum DWRITE_FONT_SIMULATIONS
{
	DWRITE_FONT_SIMULATIONS_NONE    = 0x0000,
	DWRITE_FONT_SIMULATIONS_BOLD    = 0x0001,
	DWRITE_FONT_SIMULATIONS_OBLIQUE = 0x0002
};
enum DWRITE_FONT_FACE_TYPE
{
	DWRITE_FONT_FACE_TYPE_CFF,
	DWRITE_FONT_FACE_TYPE_TRUETYPE,
	DWRITE_FONT_FACE_TYPE_TRUETYPE_COLLECTION,
	DWRITE_FONT_FACE_TYPE_TYPE1,
	DWRITE_FONT_FACE_TYPE_VECTOR,
	DWRITE_FONT_FACE_TYPE_BITMAP,
	DWRITE_FONT_FACE_TYPE_UNKNOWN
};
enum DWRITE_FONT_FILE_TYPE
{
	DWRITE_FONT_FILE_TYPE_UNKNOWN,
	DWRITE_FONT_FILE_TYPE_CFF,
	DWRITE_FONT_FILE_TYPE_TRUETYPE,
	DWRITE_FONT_FILE_TYPE_TRUETYPE_COLLECTION,
	DWRITE_FONT_FILE_TYPE_TYPE1_PFM,
	DWRITE_FONT_FILE_TYPE_TYPE1_PFB,
	DWRITE_FONT_FILE_TYPE_VECTOR,
	DWRITE_FONT_FILE_TYPE_BITMAP
};
typedef enum DWRITE_MEASURING_MODE
{
	DWRITE_MEASURING_MODE_NATURAL,
	DWRITE_MEASURING_MODE_GDI_CLASSIC,
	DWRITE_MEASURING_MODE_GDI_NATURAL
} DWRITE_MEASURING_MODE;

enum DWRITE_PIXEL_GEOMETRY
{
	DWRITE_PIXEL_GEOMETRY_FLAT,
	DWRITE_PIXEL_GEOMETRY_RGB,
	DWRITE_PIXEL_GEOMETRY_BGR
};

enum DWRITE_RENDERING_MODE
{
	DWRITE_RENDERING_MODE_DEFAULT,
	DWRITE_RENDERING_MODE_ALIASED,
	DWRITE_RENDERING_MODE_CLEARTYPE_GDI_CLASSIC,
	DWRITE_RENDERING_MODE_CLEARTYPE_GDI_NATURAL,
	DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL,
	DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL_SYMMETRIC,
	DWRITE_RENDERING_MODE_OUTLINE
};
enum DWRITE_BREAK_CONDITION
{
	DWRITE_BREAK_CONDITION_NEUTRAL,
	DWRITE_BREAK_CONDITION_CAN_BREAK,
	DWRITE_BREAK_CONDITION_MAY_NOT_BREAK,
	DWRITE_BREAK_CONDITION_MUST_BREAK
};
class IDWriteFontFace ;

struct DWRITE_GLYPH_RUN {
	IDWriteFontFace           *fontFace;
	FLOAT                     fontEmSize;
	UINT32                    glyphCount;
	const UINT16              *glyphIndices;
	const FLOAT               *glyphAdvances;
	const DWRITE_GLYPH_OFFSET *glyphOffsets;
	BOOL                      isSideways;
	UINT32                    bidiLevel;
};

struct DWRITE_TRIMMING
{
    DWRITE_TRIMMING_GRANULARITY granularity;
    UINT32 delimiter;
    UINT32 delimiterCount;
};
struct DWRITE_TEXT_RANGE
{
	UINT32 startPosition;
	UINT32 length;
};
struct DWRITE_FONT_METRICS
{
	UINT16 designUnitsPerEm;
	UINT16 ascent;
	UINT16 descent;
	INT16 lineGap;
	UINT16 capHeight;
	UINT16 xHeight;
	INT16 underlinePosition;
	UINT16 underlineThickness;
	INT16 strikethroughPosition;
	UINT16 strikethroughThickness;
};
struct DWRITE_GLYPH_METRICS
{
	INT32 leftSideBearing;
	UINT32 advanceWidth;
	INT32 rightSideBearing;
	INT32 topSideBearing;
	UINT32 advanceHeight;
	INT32 bottomSideBearing;
	INT32 verticalOriginY;
};
struct DWRITE_GLYPH_OFFSET
{
	FLOAT advanceOffset;
	FLOAT ascenderOffset;
};
struct DWRITE_MATRIX
{
	FLOAT m11;
	FLOAT m12;
	FLOAT m21;
	FLOAT m22;
	FLOAT dx;
	FLOAT dy;
};
struct DWRITE_INLINE_OBJECT_METRICS
{
	FLOAT width;
	FLOAT height;
	FLOAT baseline;
	BOOL  supportsSideways;
};
typedef struct DWRITE_OVERHANG_METRICS {
	FLOAT left;
	FLOAT top;
	FLOAT right;
	FLOAT bottom;
} DWRITE_OVERHANG_METRICS, *PDWRITE_OVERHANG_METRICS;

struct DWRITE_FONT_FEATURE
{
	DWRITE_FONT_FEATURE_TAG nameTag;
	UINT32 parameter;
};

struct DWRITE_LINE_METRICS
{
	UINT32 length;
	UINT32 trailingWhitespaceLength;
	UINT32 newlineLength;
	FLOAT height;
	FLOAT baseline;
	BOOL isTrimmed;
};
struct DWRITE_TEXT_METRICS
{
	FLOAT left;
	FLOAT top;
	FLOAT width;
	FLOAT widthIncludingTrailingWhitespace;
	FLOAT height;
	FLOAT layoutWidth;
	FLOAT layoutHeight;
	UINT32 maxBidiReorderingDepth;
	UINT32 lineCount;
};

struct DWRITE_CLUSTER_METRICS
{
	FLOAT width;
	UINT16 length;
	UINT16 canWrapLineAfter;
	UINT16 isWhitespace;
	UINT16 isNewline;
	UINT16 isSoftHyphen;
	UINT16 isRightToLeft;
	UINT16 padding;
};
struct DWRITE_HIT_TEST_METRICS
{
	UINT32 textPosition;
	UINT32 length;
	FLOAT left;
	FLOAT top;
	FLOAT width;
	FLOAT height;
	UINT32 bidiLevel;
	BOOL isText;
	BOOL isTrimmed;
};

typedef ID2D1SimplifiedGeometrySink IDWriteGeometrySink;


class IDWriteFont;
class IDWriteFontCollection;
class IDWriteFontFace;
class IDWriteFontFile;

class IDWriteTextFormat : public IUnknown
{ 
public:
    virtual HRESULT SetTextAlignment( DWRITE_TEXT_ALIGNMENT textAlignment) = 0;
    virtual HRESULT SetParagraphAlignment(DWRITE_PARAGRAPH_ALIGNMENT paragraphAlignment) = 0;
    virtual HRESULT SetWordWrapping(DWRITE_WORD_WRAPPING wordWrapping)  =0 ;
    virtual HRESULT SetReadingDirection(DWRITE_READING_DIRECTION readingDirection) = 0;
    virtual HRESULT SetFlowDirection(DWRITE_FLOW_DIRECTION flowDirection)  = 0;
    virtual HRESULT SetIncrementalTabStop(FLOAT incrementalTabStop )  = 0;
    virtual HRESULT SetTrimming( DWRITE_TRIMMING const* trimmingOptions, IDWriteInlineObject* trimmingSign)  = 0;
    virtual HRESULT SetLineSpacing(DWRITE_LINE_SPACING_METHOD lineSpacingMethod, FLOAT lineSpacing, FLOAT baseline) = 0;
    virtual DWRITE_TEXT_ALIGNMENT GetTextAlignment() = 0;
    virtual DWRITE_PARAGRAPH_ALIGNMENT GetParagraphAlignment() = 0;
    virtual DWRITE_WORD_WRAPPING GetWordWrapping() = 0;
    virtual DWRITE_READING_DIRECTION GetReadingDirection() = 0;
    virtual DWRITE_FLOW_DIRECTION GetFlowDirection() = 0;
    virtual FLOAT GetIncrementalTabStop() = 0;
    virtual HRESULT GetTrimming(DWRITE_TRIMMING* trimmingOptions,IDWriteInlineObject** trimmingSign)  = 0;
    virtual HRESULT GetLineSpacing(DWRITE_LINE_SPACING_METHOD* lineSpacingMethod, FLOAT* lineSpacing, FLOAT* baseline) = 0;
    virtual HRESULT GetFontCollection(IDWriteFontCollection** fontCollection) = 0;
    virtual UINT32 GetFontFamilyNameLength()=0;
    virtual HRESULT GetFontFamilyName(WCHAR* fontFamilyName, UINT32 nameSize ) = 0;
    virtual DWRITE_FONT_WEIGHT GetFontWeight() = 0;
    virtual DWRITE_FONT_STYLE GetFontStyle() = 0;
    virtual DWRITE_FONT_STRETCH GetFontStretch() = 0;
    virtual FLOAT GetFontSize() = 0;
    virtual UINT32 GetLocaleNameLength() = 0;
    virtual HRESULT GetLocaleName( WCHAR* localeName, UINT32 nameSize) = 0;
};

class IDWriteLocalizedStrings : public IUnknown
{
public:
	virtual UINT32 GetCount() = 0;
	virtual HRESULT FindLocaleName( WCHAR const* localeName, UINT32* index, BOOL* exists	) = 0;
	virtual HRESULT GetLocaleNameLength(UINT32 index, UINT32* length) = 0;
	virtual HRESULT GetLocaleName(UINT32 index, WCHAR* localeName, UINT32 size) = 0;
	virtual HRESULT GetStringLength(UINT32 index, UINT32* length) = 0;
	virtual HRESULT GetString(UINT32 index, WCHAR* stringBuffer, UINT32 size) = 0;
};

class IDWriteFontList : public IUnknown
{
public:
	virtual HRESULT GetFontCollection( IDWriteFontCollection** fontCollection) = 0;
	virtual UINT32 GetFontCount() = 0;
	virtual HRESULT GetFont(UINT32 index, IDWriteFont** font) = 0;
};
class IDWriteFontFamily : public IDWriteFontList
{
public:
	virtual HRESULT GetFamilyNames( IDWriteLocalizedStrings ** names) = 0;
	virtual HRESULT GetFirstMatchingFont(DWRITE_FONT_WEIGHT   weight,DWRITE_FONT_STRETCH  stretch,
		DWRITE_FONT_STYLE    style, IDWriteFont ** matchingFont) = 0;
	virtual HRESULT GetMatchingFonts(DWRITE_FONT_WEIGHT weight, DWRITE_FONT_STRETCH stretch,
		DWRITE_FONT_STYLE style, IDWriteFontList ** matchingFonts) = 0;

};

class IDWriteFontCollection : public IUnknown
{
public:
	virtual UINT32 GetFontFamilyCount() = 0;
	virtual HRESULT GetFontFamily(UINT32 index, IDWriteFontFamily** fontFamily) = 0;
	virtual HRESULT FindFamilyName(WCHAR const* familyName, UINT32* index, BOOL* exists) = 0;
	virtual HRESULT GetFontFromFontFace(IDWriteFontFace* fontFace, IDWriteFont** font) = 0;
};

class IDWriteFontFileLoader : public IUnknown
{
public:
	virtual HRESULT CreateStreamFromKey( void const* fontFileReferenceKey, UINT32 fontFileReferenceKeySize,
		 IDWriteFontFileStream** fontFileStream) = 0;
};

class IDWriteFontFile : public IUnknown
{
public:
	virtual HRESULT GetReferenceKey( void const** fontFileReferenceKey, UINT32* fontFileReferenceKeySize) = 0;
	virtual HRESULT GetLoader( IDWriteFontFileLoader** fontFileLoader) = 0;
	virtual HRESULT Analyze(BOOL* isSupportedFontType, DWRITE_FONT_FILE_TYPE* fontFileType, DWRITE_FONT_FACE_TYPE* fontFaceType,
		UINT32* numberOfFaces) = 0;
};
class IDWriteRenderingParams : public IUnknown
{
public:
	virtual FLOAT GetGamma() = 0;
	virtual FLOAT GetEnhancedContrast() = 0;
	virtual FLOAT GetClearTypeLevel() = 0;
	virtual DWRITE_PIXEL_GEOMETRY GetPixelGeometry() = 0;
	virtual DWRITE_RENDERING_MODE GetRenderingMode() = 0;
};

class IDWriteFontFace : public IUnknown
{
public:
	virtual DWRITE_FONT_FACE_TYPE GetType() = 0;
	virtual HRESULT GetFiles( UINT32* numberOfFiles, IDWriteFontFile** fontFiles) = 0;
	virtual UINT32 GetIndex() = 0;
	virtual DWRITE_FONT_SIMULATIONS GetSimulations() = 0;
	virtual BOOL IsSymbolFont() = 0;
	virtual void GetMetrics( DWRITE_FONT_METRICS* fontFaceMetrics) = 0;
	virtual UINT16 GetGlyphCount() = 0;
	virtual HRESULT GetDesignGlyphMetrics(UINT16 const* glyphIndices, UINT32 glyphCount, DWRITE_GLYPH_METRICS* glyphMetrics,
		BOOL isSideways = FALSE) = 0;
	virtual HRESULT GetGlyphIndices( UINT32 const* codePoints, UINT32 codePointCount, UINT16* glyphIndices) = 0;
	virtual HRESULT TryGetFontTable( UINT32 openTypeTableTag, const void** tableData, UINT32* tableSize, void** tableContext,
		BOOL* exists) = 0;
	virtual void ReleaseFontTable( void* tableContext) = 0;
	virtual HRESULT GetGlyphRunOutline(FLOAT emSize, const UINT16* glyphIndices, const FLOAT* glyphAdvances, const DWRITE_GLYPH_OFFSET * glyphOffsets,
		UINT32 glyphCount, BOOL isSideways, BOOL isRightToLeft, IDWriteGeometrySink* geometrySink) = 0;
	virtual HRESULT GetRecommendedRenderingMode(FLOAT emSize, FLOAT pixelsPerDip, DWRITE_MEASURING_MODE measuringMode, 
		IDWriteRenderingParams* renderingParams, DWRITE_RENDERING_MODE* renderingMode) = 0;
	virtual HRESULT GetGdiCompatibleMetrics(FLOAT emSize, FLOAT pixelsPerDip, DWRITE_MATRIX const* transform,
		DWRITE_FONT_METRICS* fontFaceMetrics) = 0;
	virtual HRESULT GetGdiCompatibleGlyphMetrics(FLOAT emSize, FLOAT pixelsPerDip, DWRITE_MATRIX const* transform,
		BOOL useGdiNatural,const UINT16* glyphIndices, UINT32 glyphCount, DWRITE_GLYPH_METRICS* glyphMetrics,
		BOOL isSideways = FALSE) = 0;
};

class IDWriteFont : public IUnknown
{
public:
	virtual HRESULT GetFontFamily(IDWriteFontFamily** fontFamily) = 0;
	virtual DWRITE_FONT_WEIGHT GetWeight() = 0;
	virtual DWRITE_FONT_STRETCH GetStretch() = 0;
	virtual DWRITE_FONT_STYLE GetStyle() = 0;
	virtual BOOL IsSymbolFont() = 0;
	virtual HRESULT GetFaceNames( IDWriteLocalizedStrings** names) = 0;
	virtual HRESULT GetInformationalStrings(DWRITE_INFORMATIONAL_STRING_ID informationalStringID,
		IDWriteLocalizedStrings** informationalStrings, BOOL* exists) = 0;
	virtual DWRITE_FONT_SIMULATIONS GetSimulations() = 0;
	virtual void GetMetrics( DWRITE_FONT_METRICS* fontMetrics) = 0;
	virtual HRESULT HasCharacter(UINT32 unicodeValue, BOOL* exists) = 0;
	virtual HRESULT CreateFontFace( IDWriteFontFace** fontFace) = 0;
};
class IDWriteInlineObject : public IUnknown
{
public:
	virtual HRESULT Draw(void * clientDrawingContext, IDWriteTextRenderer * renderer,
		FLOAT  originX,	FLOAT  originY,	BOOL  isSideways, BOOL  isRightToLeft,	IUnknown * clientDrawingEffect	) = 0;
	virtual HRESULT GetBreakConditions(DWRITE_BREAK_CONDITION * breakConditionBefore,
		DWRITE_BREAK_CONDITION * breakConditionAfter) = 0;
	virtual HRESULT GetMetrics( DWRITE_INLINE_OBJECT_METRICS * metrics) = 0;
	virtual HRESULT GetOverhangMetrics( DWRITE_OVERHANG_METRICS *overhangs) = 0;

};
class IDWriteTypography : public IUnknown
{
public:
	virtual HRESULT AddFontFeature(DWRITE_FONT_FEATURE  fontFeature) = 0;
	virtual HRESULT GetFontFeature(UINT32  fontFeatureIndex, DWRITE_FONT_FEATURE * fontFeature) = 0;
	virtual UINT32 GetFontFeatureCount() = 0;
};

class IDWritePixelSnapping : public IUnknown
{
public:
	virtual HRESULT IsPixelSnappingDisabled(void* clientDrawingContext, BOOL* isDisabled) = 0;
	virtual HRESULT GetCurrentTransform(void * clientDrawingContext, DWRITE_MATRIX * transform) = 0;
	virtual HRESULT GetPixelsPerDip(void * clientDrawingContext, FLOAT * pixelsPerDip) = 0;

};

class IDWriteTextLayout : public IDWriteTextFormat
{
public:
	virtual HRESULT SetMaxWidth(FLOAT maxWidth) = 0;
	virtual HRESULT SetMaxHeight(FLOAT maxHeight) = 0;
	virtual HRESULT SetFontCollection(IDWriteFontCollection* fontCollection, DWRITE_TEXT_RANGE textRange) = 0;
	virtual HRESULT SetFontFamilyName(WCHAR const* fontFamilyName, DWRITE_TEXT_RANGE textRange) = 0;
	virtual HRESULT SetFontWeight(DWRITE_FONT_WEIGHT fontWeight, DWRITE_TEXT_RANGE textRange) = 0;
	virtual HRESULT SetFontStyle(DWRITE_FONT_STYLE fontStyle, DWRITE_TEXT_RANGE textRange) = 0;
	virtual HRESULT SetFontStretch(	DWRITE_FONT_STRETCH fontStretch, DWRITE_TEXT_RANGE textRange) = 0;
	virtual HRESULT SetFontSize(FLOAT fontSize,	DWRITE_TEXT_RANGE textRange	) = 0;
	virtual HRESULT SetUnderline(BOOL hasUnderline,	DWRITE_TEXT_RANGE textRange	) = 0;
	virtual HRESULT SetStrikethrough(BOOL hasStrikethrough,	DWRITE_TEXT_RANGE textRange	) = 0;
	virtual HRESULT SetDrawingEffect(IUnknown* drawingEffect, DWRITE_TEXT_RANGE textRange) = 0;
	virtual HRESULT SetInlineObject(IDWriteInlineObject* inlineObject, DWRITE_TEXT_RANGE textRange) = 0;
	virtual HRESULT SetTypography(IDWriteTypography* typography, DWRITE_TEXT_RANGE textRange) = 0;
	virtual HRESULT SetLocaleName(const WCHAR* localeName, DWRITE_TEXT_RANGE textRange	) = 0;
	virtual FLOAT GetMaxWidth() = 0;
	virtual FLOAT GetMaxHeight() = 0;
	virtual HRESULT GetFontCollection(UINT32 currentPosition, IDWriteFontCollection** fontCollection, DWRITE_TEXT_RANGE* textRange = NULL) = 0;
	virtual HRESULT GetFontFamilyNameLength(UINT32 currentPosition, UINT32* nameLength, DWRITE_TEXT_RANGE* textRange = NULL) = 0;
	virtual HRESULT GetFontFamilyName(UINT32 currentPosition, WCHAR* fontFamilyName, UINT32 nameSize, DWRITE_TEXT_RANGE* textRange = NULL) = 0;
	virtual HRESULT GetFontWeight(UINT32 currentPosition, DWRITE_FONT_WEIGHT* fontWeight, DWRITE_TEXT_RANGE* textRange = NULL) = 0;
	virtual HRESULT GetFontStyle(UINT32 currentPosition, DWRITE_FONT_STYLE* fontStyle, DWRITE_TEXT_RANGE* textRange = NULL) = 0;
	virtual HRESULT GetFontStretch(UINT32 currentPosition, DWRITE_FONT_STRETCH* fontStretch, DWRITE_TEXT_RANGE* textRange = NULL) = 0;
	virtual HRESULT GetFontSize(UINT32 currentPosition, FLOAT* fontSize, DWRITE_TEXT_RANGE* textRange = NULL) = 0;
	virtual HRESULT GetUnderline(UINT32 currentPosition, BOOL* hasUnderline, DWRITE_TEXT_RANGE* textRange = NULL) = 0;
	virtual HRESULT GetStrikethrough(UINT32 currentPosition, BOOL* hasStrikethrough, DWRITE_TEXT_RANGE* textRange = NULL) = 0;
	virtual HRESULT GetDrawingEffect(UINT32 currentPosition, IUnknown** drawingEffect, DWRITE_TEXT_RANGE* textRange = NULL) = 0;
	virtual HRESULT GetInlineObject(UINT32 currentPosition, IDWriteInlineObject** inlineObject, DWRITE_TEXT_RANGE* textRange = NULL	) = 0;
	virtual HRESULT GetTypography(UINT32 currentPosition, IDWriteTypography** typography, DWRITE_TEXT_RANGE* textRange = NULL) = 0;
	virtual HRESULT GetLocaleNameLength(UINT32 currentPosition, UINT32* nameLength, DWRITE_TEXT_RANGE* textRange = NULL) = 0;
	virtual HRESULT GetLocaleName(UINT32 currentPosition, WCHAR* localeName, UINT32 nameSize, DWRITE_TEXT_RANGE* textRange = NULL) = 0;
	virtual HRESULT Draw( void* clientDrawingContext, IDWriteTextRenderer* renderer, FLOAT originX,	FLOAT originY) = 0;
	virtual HRESULT GetLineMetrics( DWRITE_LINE_METRICS* lineMetrics, UINT32 maxLineCount, UINT32* actualLineCount) = 0;
	virtual HRESULT GetMetrics( DWRITE_TEXT_METRICS* textMetrics) = 0;
	virtual HRESULT GetOverhangMetrics( DWRITE_OVERHANG_METRICS* overhangs) = 0;
	virtual HRESULT GetClusterMetrics( DWRITE_CLUSTER_METRICS* clusterMetrics, UINT32 maxClusterCount, UINT32* actualClusterCount) = 0;
	virtual HRESULT DetermineMinWidth( FLOAT* minWidth) = 0;
	virtual HRESULT HitTestPoint(FLOAT pointX, FLOAT pointY, BOOL* isTrailingHit, BOOL* isInside, DWRITE_HIT_TEST_METRICS* hitTestMetrics) = 0;
	virtual HRESULT HitTestTextPosition(UINT32 textPosition, BOOL isTrailingHit, FLOAT* pointX, FLOAT* pointY, DWRITE_HIT_TEST_METRICS* hitTestMetrics) = 0;
	virtual HRESULT HitTestTextRange(UINT32 textPosition, UINT32 textLength, FLOAT originX, FLOAT originY, DWRITE_HIT_TEST_METRICS* hitTestMetrics,
		UINT32 maxHitTestMetricsCount,	UINT32* actualHitTestMetricsCount	) = 0;
};


class IDWriteFactory : public IUnknown
{
	virtual HRESULT GetSystemFontCollection(IDWriteFontCollection** fontCollection,
		BOOL checkForUpdates = FALSE) = 0;

	virtual HRESULT CreateCustomFontCollection(	IDWriteFontCollectionLoader* collectionLoader,
		void const* collectionKey, UINT32 collectionKeySize, IDWriteFontCollection** fontCollection	) = 0;
	virtual HRESULT RegisterFontCollectionLoader(IDWriteFontCollectionLoader* fontCollectionLoader) = 0;
	virtual HRESULT UnregisterFontCollectionLoader(IDWriteFontCollectionLoader* fontCollectionLoader) = 0;
	virtual HRESULT CreateFontFileReference( WCHAR const* filePath, FILETIME const* lastWriteTime,
		IDWriteFontFile** fontFile) = 0;

	virtual HRESULT CreateCustomFontFileReference( void const* fontFileReferenceKey,
		UINT32 fontFileReferenceKeySize, IDWriteFontFileLoader* fontFileLoader, IDWriteFontFile** fontFile) = 0;

	virtual HRESULT CreateFontFace(	DWRITE_FONT_FACE_TYPE fontFaceType, UINT32 numberOfFiles, IDWriteFontFile* const* fontFiles,
		UINT32 faceIndex, DWRITE_FONT_SIMULATIONS fontFaceSimulationFlags, IDWriteFontFace** fontFace) = 0;

	virtual HRESULT CreateRenderingParams(IDWriteRenderingParams** renderingParams) = 0;
	virtual HRESULT CreateMonitorRenderingParams(HMONITOR monitor, IDWriteRenderingParams** renderingParams) = 0;

	virtual HRESULT CreateCustomRenderingParams(FLOAT gamma, FLOAT enhancedContrast, FLOAT clearTypeLevel, DWRITE_PIXEL_GEOMETRY pixelGeometry,
		DWRITE_RENDERING_MODE renderingMode, IDWriteRenderingParams** renderingParams) = 0;

	virtual HRESULT RegisterFontFileLoader(	IDWriteFontFileLoader* fontFileLoader) = 0;

	virtual HRESULT UnregisterFontFileLoader(IDWriteFontFileLoader* fontFileLoader) = 0;
	virtual HRESULT CreateTextFormat(WCHAR const* fontFamilyName, IDWriteFontCollection* fontCollection,
		DWRITE_FONT_WEIGHT fontWeight, DWRITE_FONT_STYLE fontStyle,	DWRITE_FONT_STRETCH fontStretch,
		FLOAT fontSize, WCHAR const* localeName, IDWriteTextFormat** textFormat) = 0;

	virtual HRESULT CreateTypography(IDWriteTypography** typography) = 0;
	virtual HRESULT GetGdiInterop(IDWriteGdiInterop** gdiInterop) = 0;


	virtual HRESULT CreateTextLayout(WCHAR const* string, UINT32 stringLength, IDWriteTextFormat* textFormat,
		FLOAT maxWidth,	FLOAT maxHeight, IDWriteTextLayout** textLayout) = 0;

	virtual HRESULT CreateGdiCompatibleTextLayout( WCHAR const* string,
		UINT32 stringLength, IDWriteTextFormat* textFormat,	FLOAT layoutWidth,
		FLOAT layoutHeight,	FLOAT pixelsPerDip,	DWRITE_MATRIX const* transform,
		BOOL useGdiNatural, IDWriteTextLayout** textLayout) = 0;

	virtual HRESULT CreateEllipsisTrimmingSign(	IDWriteTextFormat* textFormat, IDWriteInlineObject** trimmingSign) = 0;

	virtual HRESULT CreateTextAnalyzer( IDWriteTextAnalyzer** textAnalyzer) = 0;

	virtual HRESULT CreateNumberSubstitution( DWRITE_NUMBER_SUBSTITUTION_METHOD substitutionMethod, WCHAR const* localeName,
		BOOL ignoreUserOverride, IDWriteNumberSubstitution** numberSubstitution	) = 0;

	virtual HRESULT CreateGlyphRunAnalysis( DWRITE_GLYPH_RUN const* glyphRun, FLOAT pixelsPerDip,
		DWRITE_MATRIX const* transform, DWRITE_RENDERING_MODE renderingMode,
		DWRITE_MEASURING_MODE measuringMode, FLOAT baselineOriginX,
		FLOAT baselineOriginY, IDWriteGlyphRunAnalysis** glyphRunAnalysis) = 0;

}; 
